home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / net_des.arc / BENCHMAR.C next >
C/C++ Source or Header  |  1988-12-05  |  684b  |  40 lines

  1. /* Just run DES in a loop consuming CPU time; good for benchmarking
  2.  * Phil Karn
  3.  */
  4. #include <stdio.h>
  5. main()
  6. {
  7.     static char key[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
  8.     static char work[8];
  9.     long iter,count;
  10.  
  11.     desinit(0);
  12.     printf("Setting key: "); put8(key); printf("\n");
  13.     setkey(key);
  14.     printf("Starting value: "); put8(work); printf("\n");
  15.     printf("Number of iterations: ");
  16.     scanf("%ld",&count);
  17.  
  18.     for(iter = 0;iter < count; iter++)
  19.         endes(work);
  20. }
  21. get8(cp)
  22. char *cp;
  23. {
  24.     int i,t;
  25.  
  26.     for(i=0;i<8;i++){
  27.         scanf("%2x",&t);
  28.         *cp++ = t;
  29.     }
  30. }
  31. put8(cp)
  32. char *cp;
  33. {
  34.     int i;
  35.  
  36.     for(i=0;i<8;i++){
  37.         printf("%2x ",*cp++ & 0xff);
  38.     }
  39. }
  40.